﻿
using System.Data;
using System.Data.SqlClient;
using System;

namespace BLL.Services
{
    public static class StoredProcedures
    {
        public static partial class Administrators
        {

            public static SqlCommand GetByLogin(SqlConnection conn, string @login)
            {
                var cmd = new SqlCommand("administrators_get_by_login", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string GetByLogin = "administrators_get_by_login";
            }
        }
        public static partial class Administrators
        {

            public static SqlCommand Insert(SqlConnection conn, string @login, object @password, object @salt)
            {
                var cmd = new SqlCommand("administrators_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string Insert = "administrators_insert";
            }
        }
        public static partial class Administrators
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("administrators_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string SelectAll = "administrators_select_all";
            }
        }
        public static partial class Administrators
        {

            public static SqlCommand Update(SqlConnection conn, string @login, object @password, object @salt)
            {
                var cmd = new SqlCommand("administrators_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string Update = "administrators_update";
            }
        }
        public static partial class Auto
        {

            public static SqlCommand AdministratorsDelete(SqlConnection conn, string @login)
            {
                var cmd = new SqlCommand("auto_Administrators_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Auto
            {
                public const string AdministratorsDelete = "auto_Administrators_delete";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Delete(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("users_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Delete = "users_delete";
            }
        }
        public static partial class Users
        {

            public static SqlCommand GetByEmailOrLogin(SqlConnection conn, string @email)
            {
                var cmd = new SqlCommand("users_get_by_email_or_login", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string GetByEmailOrLogin = "users_get_by_email_or_login";
            }
        }
        public static partial class Users
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @email, string @login)
            {
                var cmd = new SqlCommand("users_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string GetListing = "users_get_listing";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Insert(SqlConnection conn, string @email, object @password, object @salt, string @login, DateTime? @registrationDate, byte? @status)
            {
                var cmd = new SqlCommand("users_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@registrationDate", SqlDbType.DateTime2) { Value = @registrationDate });
                cmd.Parameters.Add(new SqlParameter("@status", SqlDbType.TinyInt) { Value = @status });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Insert = "users_insert";
            }
        }
        public static partial class Users
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("users_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string SelectAll = "users_select_all";
            }
        }
        public static partial class Users
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("users_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string SelectById = "users_select_by_id";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Update(SqlConnection conn, int? @userId, string @email, object @password, object @salt, string @login, byte? @status)
            {
                var cmd = new SqlCommand("users_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@status", SqlDbType.TinyInt) { Value = @status });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Update = "users_update";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Validate(SqlConnection conn, int? @userId, string @login, string @email)
            {
                var cmd = new SqlCommand("users_validate", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Validate = "users_validate";
            }
        }
    }
}